﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace MapleLib.Examples.MapEditor
{
	public class WzLifeObject : IWzDrawableObject
	{
		public Bitmap image;
		public Point drawPos;
		public Rectangle drawRect;
		public string type;
		public int id;
		public bool flip;
		private bool flipped = false;
		public Point pos;
		public Point origin;
		public int cY;
		public WzMap map;

		public void drawObject(Graphics g)
		{
			if (flip && !flipped)
			{
				image.RotateFlip(RotateFlipType.RotateNoneFlipX);
				flipped = true;
			}
			if (drawPos.IsEmpty)
			{
				if (!flip)
				{
					drawPos = new Point(pos.X + map.cX - origin.X, cY + map.cY - origin.Y);
				}
				else
				{
					drawPos = new Point(pos.X + map.cX + origin.X - image.Width, cY + map.cY - origin.Y);
				}
				drawRect = new Rectangle(drawPos.X, drawPos.Y, image.Width, image.Height);
			}
			g.DrawImage(image, drawPos);
		}
	}
}